| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | Mivhak.component('dropdown', { |
||
| 8 | created: function() { |
||
| 9 | var $this = this; |
||
| 10 | $.each(this.items, function(i, item) { |
||
| 11 | if( typeof item === 'string') item = Mivhak.buttons[item]; |
||
| 12 | var button = $('<div>',{class: 'mivhak-dropdown-button', text: item.text, click: function(e){item.click.call($this.mivhakInstance,e);}}); |
||
| 13 | if(item.toggle) |
||
| 14 | { |
||
| 15 | button.$toggle = Mivhak.render('toggle'); |
||
| 16 | |||
| 17 | // Toggle only if not clicking on the toggle itself (which makes it toggle as it is) |
||
| 18 | button.click(function(e){if($(e.target).parents('.mivhak-dropdown-button').length !== 1)button.$toggle.toggle();}); |
||
| 19 | button.append(button.$toggle.$el); |
||
| 20 | } |
||
| 21 | $this.$el.append(button); |
||
| 22 | }); |
||
| 23 | |||
| 24 | // Hide dropdown on outside click |
||
| 25 | $(window).click(function(e){ |
||
| 26 | if(!$(e.target).closest('.mivhak-icon-cog').length) { |
||
| 27 | $this.$el.removeClass('mivhak-dropdown-visible'); |
||
| 28 | $this.$el.parent().removeClass('mivhak-button-active'); |
||
| 29 | } |
||
| 30 | }); |
||
| 31 | }, |
||
| 32 | methods: { |
||
| 38 | }); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.